//
//  tabbar.m
//  EFExtend
//
//  Created by mac on 15/3/19.
//  Copyright (c) 2015年 Eric. All rights reserved.
//

#import "tabbar.h"

@interface InfoSearchCell : UICollectionViewCell


@end

@interface InfoSearchCell ()<UISearchBarDelegate>

@property (nonatomic,strong)HMUITapbarView *tab;
@property (nonatomic,strong)UISearchBar *searchBar;

@end

@implementation InfoSearchCell


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self.tab updateItems];
        
    }
    return self;
}

- (UISearchBar *)searchBar{
    if (_searchBar==nil) {
        _searchBar = [[UISearchBar alloc]init];
        _searchBar.placeholder = @"back.png";
        _searchBar.delegate = self;
        [_searchBar clearBackBar];
        
    }
    return _searchBar;
}

- (HMUITapbarView *)tab{
    if (_tab==nil) {
        _tab = [[HMUITapbarView alloc]initWithFrame:self.bounds];
        _tab.barStyle = UITapbarStyleCanFlexible;
        _tab.indentation = 10;
        _tab.tail = 10;
        _tab.eventReceiver = self;
        [self addSubview:_tab];
        [_tab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.mas_top).offset(0);
            make.left.mas_equalTo(self.mas_left).offset(0);
            make.height.mas_equalTo(40);
            make.right.mas_equalTo(self.mas_right).offset(0);
        }];
        
        UIButten * btn = [_tab addItemWithTitle:@"tete" imageName:@"back.png" size:CGSizeMake(40, 40) background:YES] ;
        [btn setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
        btn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_tab addFlexible];
        
        [_tab addContentView:self.searchBar size:CGSizeMake(self.width-20-40-66, self.height)];
        [_tab addFlexible];
        [_tab addItemWithTitle:nil imageName:@"back.png" size:CGSizeMake(33, 40)].tagString = @"shitu";
        [_tab addItemWithTitle:nil imageName:@"back.png" size:CGSizeMake(33, 40)].tagString = @"liebiao";
        [_tab setSelectedIndex:2 witoutSignal:NO];
    }
    return _tab;
}

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{
    
    return NO;
}

ON_TapBar(signal){
    if ([signal is:[HMUITapbarView TAPNOSELECTED]]) {
        if (_tab.selectedIndex==0) {
            [signal returnYES];
        }else{
            signal.forward = YES;
        }
    }
}

@end

@interface tabbar ()

@end

@implementation tabbar

- (void)dealloc
{
   
    HM_SUPER_DEALLOC();
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidAppear:(BOOL)animated{
    [super viewDidAppear:animated];
    
    FUNC;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    [self.customNavLeftBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavLeftBtn setFrame:CGRectMakeBound(32, 32)];
    
    [self.customNavRightBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
    [self.customNavRightBtn setFrame:CGRectMakeBound(32, 32)];
    
    self.view.backgroundColor = [UIColor md_grey_200];
    
//    HMUITapbarView *bar = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
//    bar.space = 5;
////    bar.defaultColor = [UIColor md_grey_500];
//    bar.selectedColor = [UIColor md_red_300];
//    bar.slideviewColor = [UIColor md_red_500];
//    bar.slideStyle = UITapbarSlideStyleBottom;
//    bar.eventReceiver = self;
//    [bar addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
//    [bar addSpace];
//    [bar addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
//    [bar addSpace];
//    [bar addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
//    
//    [self customNavTitleView:bar];

    HMUITapbarView *bar = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar.space = 5;
    //    bar.defaultColor = [UIColor md_grey_500];
    bar.selectedColor = [UIColor md_red_300];
    bar.slideviewColor = [UIColor md_red_500];
    bar.slideStyle = UITapbarSlideStyleBottom;
    bar.barStyle = UITapbarStyleAutolayout;
    bar.eventReceiver = self;
    bar.tag = 121;
    UIButten *btn = [bar addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(bar.mas_centerY).offset(0);
        make.width.mas_equalTo(50);
        make.left.mas_equalTo(bar.mas_left).offset(2);
    }];
    UIButten *btn2 = [bar addItemWithTitle:@"热门" imageName:nil size:CGSizeMake(50, 35)];
    [btn2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(bar.mas_centerY).offset(0);
        make.width.mas_equalTo(50);
        make.left.mas_equalTo(btn.mas_right).offset(2);
    }];
    UIButten *btn3 = [bar addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [btn3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(bar.mas_centerY).offset(0);
        make.width.mas_equalTo(50);
        make.left.mas_equalTo(btn2.mas_right).offset(2);
    }];
    [self customNavTitleView:bar];
    
    HMUITapbarView *bottomBar = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];

    bottomBar.space = 5;
    bottomBar.backgroundColor = [UIColor whiteColor];
    bottomBar.defaultColor = [UIColor md_grey_500];
    bottomBar.slideStyle = UITapbarSlideStyleBottom;
    bottomBar.barStyle = UITapbarStyleFitSize;
    bottomBar.eventReceiver = self;
    UIButten *tbn = [bottomBar addItemWithTitle:@"有问有答" imageName:@"back.png" size:CGSizeZero];
    tbn.imageSize = CGSizeMake(28, 28);
    tbn.buttenType = UIButtenTypeIconSideLeft;
    tbn.titleLabel.font = [UIFont systemFontOfSize:14];
    tbn.style__ = [HMUIInsetStyle styleWithInset:UIEdgeInsetsAll(5) next:nil];
    
    [bottomBar addItemWithTitle:@"我的关注" imageName:nil size:CGSizeZero];
    [bottomBar addItemWithTitle:@"热门讨论" imageName:nil size:CGSizeZero];
    [bottomBar addItemWithTitle:@"积分兑换" imageName:nil size:CGSizeZero];
    
    [self.view addSubview:bottomBar];
    
    [bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(self.view.mas_bottom).offset(0);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    [bottomBar updateItems];
    bottomBar.tag = 100;
    
    HMUITapbarView *bar2 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar2.space = 5;
    bar2.tag = 200;
    bar2.backgroundColor = [UIColor md_green_200];
    bar2.defaultColor = [UIColor md_grey_500];
    bar2.slideStyle = UITapbarSlideStyleBottom;
    bar2.eventReceiver = self;
    bar2.barStyle = UITapbarStyleCanScroll;
    [bar2 showMask:YES];
    
    [bar2 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addSpace];
    [bar2 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar2 addItemWithTitle:@"..." imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar2];
    
    [bar2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bottomBar.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
    
    HMUITapbarView *bar3 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar3.space = 5;
    bar3.backgroundColor = [UIColor md_green_200];
    bar3.defaultColor = [UIColor md_grey_500];
    bar3.slideStyle = UITapbarSlideStyleBottom;
    bar3.eventReceiver = self;
    bar3.barStyle = UITapbarStyleCustom;
    bar3.autoSelectedCenter = YES;
    
    bar3.slideStyle = UITapbarSlideStyleCenter;
    bar3.slideHeight = 30;
    bar3.slideAnimate = UITapbarSlideAnimatedEarthworm;
    bar3.slideAnimateDuration = 2.f;
    
    bar3.slideview.backgroundColor = [UIColor clearColor];
//    HMUIStyle *sytle = [HMUIShapeStyle styleWithShape:[HMUIRoundedRectangleShape shapeWithRadius:15] next:[HMUISolidFillStyle styleWithColor:[[UIColor md_red_500] colorWithAlphaComponent:1.f] next:[HMUIInsetStyle styleWithInset:UIEdgeInsetsAll(5) next:[HMUIShapeStyle styleWithShape:[HMUIRoundedRectangleShape shapeWithRadius:10] next:[HMUISolidFillStyle styleWithColor:[UIColor md_red_50] next:nil]]]]];
    HMUIStyle *sytle = [HMUIShapeStyle styleWithShape:[HMUIRoundedRectangleShape shapeWithRadius:12] next:[HMUISolidBorderStyle styleWithColor:[[UIColor md_red_500] colorWithAlphaComponent:1.f] width:5 next:nil]];
    
    bar3.slideview.backgroundImage = [[UIImage imageForStyle:sytle size:CGSizeMake(30, 30) scale:[UIScreen mainScreen].scale] stretched];
    
    [bar3 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addSpace];
    [bar3 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addSpace];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addSpace];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addItemWithTitle:@"..." imageName:nil size:CGSizeMake(50, 35)];
    [bar3 addSpace:50];
    
    [self.view addSubview:bar3];
    
    [bar3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bar2.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
//    UIVisualEffect *blurEffect;
//    blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleExtraLight];
//    UIVisualEffectView *visualEffectView;
//    visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
//     [self.view addSubview:visualEffectView];
//    visualEffectView.userInteractionEnabled = NO;
//    [visualEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.mas_equalTo(0);
//        make.bottom.mas_equalTo(bar2.mas_top).offset(-10);
//        make.width.mas_equalTo(self.view.mas_width);
//        make.height.mas_equalTo(44);
//    }];
//    

    HMUITapbarView *bar4 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar4.space = 5;
    bar4.backgroundColor = [UIColor whiteColor];
    bar4.defaultColor = [UIColor md_grey_500];
    bar4.slideStyle = UITapbarSlideStyleBottom;
    bar4.eventReceiver = self;
    bar4.barStyle = UITapbarStyleFitSize;
    
    [bar4 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar4 addSpace];
    [bar4 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar4 addSpace];
    [bar4 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar4];
    
    [bar4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bar3.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
    HMUITapbarView *bar5 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar5.space = 5;
    bar5.backgroundColor = [UIColor whiteColor];
    bar5.defaultColor = [UIColor md_grey_500];
    bar5.slideStyle = UITapbarSlideStyleBottom;
    bar5.eventReceiver = self;
    bar5.barStyle = UITapbarStyleFitSpace;
    
    [bar5 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar5 addSpace];
    [bar5 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar5 addSpace];
    [bar5 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar5];
    
    [bar5 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bar4.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
    HMUITapbarView *bar6 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar6.space = 5;
    bar6.backgroundColor = [UIColor whiteColor];
    bar6.defaultColor = [UIColor md_grey_500];
    bar6.slideStyle = UITapbarSlideStyleBottom;
    bar6.eventReceiver = self;
    bar6.barStyle = UITapbarStyleCenter;
    
    [bar6 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar6 addSpace];
    [bar6 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar6 addSpace];
    [bar6 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar6];
    
    [bar6 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bar5.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
    HMUITapbarView *bar7 = [[HMUITapbarView alloc]init];
//    bar7.space = 5;
    bar7.indentation = 10;
    bar7.tail = 10;
    bar7.backgroundColor = [UIColor whiteColor];
    bar7.defaultColor = [UIColor md_grey_500];
    bar7.slideStyle = UITapbarSlideStyleBottom;
    bar7.eventReceiver = self;
    bar7.barStyle = UITapbarStyleCanFlexible;
    
    
    [[bar7 addItemWithTitle:@"精选23" imageName:nil size:CGSizeMake(50, 40)] EFBackgroundColor:[UIColor md_red_100]];
    [bar7 addFlexible];
    [[bar7 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(self.view.width-20-40-66, 35)] EFBackgroundColor:[UIColor md_red_50]];
    [bar7 addFlexible];
    [[bar7 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)] EFBackgroundColor:[UIColor md_red_200]];
    [[bar7 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(40, 35)] EFBackgroundColor:[UIColor md_red_300]];
    
    [self.view addSubview:bar7];
    
    [bar7 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.mas_equalTo(bar6.mas_top).offset(-10);
        make.width.mas_equalTo(self.view.mas_width);
        make.height.mas_equalTo(44);
    }];
    
    
    /**
     *  vertial
     *
     *  @return
     */
    HMUITapbarView *leftBar = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    leftBar.space = 5;
    leftBar.backgroundColor = [UIColor whiteColor];
    leftBar.defaultColor = [UIColor md_grey_500];
    leftBar.slideStyle = UITapbarSlideStyleBottom;
    leftBar.eventReceiver = self;
    leftBar.direction = UITapbarDirectionVertical;
    
    [leftBar addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [leftBar addSpace];
    [leftBar addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [leftBar addSpace];
    [leftBar addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:leftBar];
    
    [leftBar mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view.mas_top).offset(0);
        make.left.mas_equalTo(self.view.mas_left).offset(0);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    
    HMUITapbarView *bar21 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar21.space = 5;
    
    bar21.backgroundColor = [UIColor md_green_200];
    bar21.defaultColor = [UIColor md_grey_500];
    bar21.slideStyle = UITapbarSlideStyleBottom;
    bar21.eventReceiver = self;
    bar21.barStyle = UITapbarStyleCanScroll;
    bar21.direction = UITapbarDirectionVertical;
    
    [bar21 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addSpace];
    [bar21 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar21 addItemWithTitle:@"..." imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar21];
    
    bar21.direction = UITapbarDirectionVertical;
    [bar21 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(leftBar.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    
    HMUITapbarView *bar31 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar31.space = 5;
    bar31.backgroundColor = [UIColor md_green_200];
    bar31.defaultColor = [UIColor md_grey_500];
    bar31.eventReceiver = self;
    bar31.barStyle = UITapbarStyleCustom;
    
    bar31.autoSelectedCenter = YES;
    
    bar31.slideStyle = UITapbarSlideStyleCenter;
    bar31.slideHeight = 30;
    bar31.slideAnimate = UITapbarSlideAnimatedEarthworm;
    
    bar31.slideview.backgroundColor = [UIColor clearColor];
    bar31.slideview.style__ = [HMUIShapeStyle styleWithShape:[HMUIRoundedRectangleShape shapeWithRadius:15] next:[HMUISolidFillStyle styleWithColor:[[UIColor md_red_50] colorWithAlphaComponent:.5f] next:nil]];
    
    [bar31 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addSpace];
    [bar31 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addSpace];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addSpace];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar31 addItemWithTitle:@"..." imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar31];
    
    bar31.direction = UITapbarDirectionVertical;
    [bar31 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(bar21.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    
    
    HMUITapbarView *bar41 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar41.space = 5;
    bar41.backgroundColor = [UIColor whiteColor];
    bar41.defaultColor = [UIColor md_grey_500];
    bar41.slideStyle = UITapbarSlideStyleBottom;
    bar41.eventReceiver = self;
    bar41.barStyle = UITapbarStyleFitSize;
    
    [bar41 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar41 addSpace];
    [bar41 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar41 addSpace];
    [bar41 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar41];
    
    bar41.direction = UITapbarDirectionVertical;
    [bar41 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(bar31.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    HMUITapbarView *bar51 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar51.space = 5;
    bar51.backgroundColor = [UIColor whiteColor];
    bar51.defaultColor = [UIColor md_grey_500];
    bar51.slideStyle = UITapbarSlideStyleBottom;
    bar51.eventReceiver = self;
    bar51.barStyle = UITapbarStyleFitSpace;
    
    [bar51 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar51 addSpace];
    [bar51 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar51 addSpace];
    [bar51 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar51];
    
    bar51.direction = UITapbarDirectionVertical;
    [bar51 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(bar41.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    HMUITapbarView *bar61 = [[HMUITapbarView alloc]initWithFrame:CGRectMake(0, 0, 160, 35)];
    bar61.space = 5;
    bar61.backgroundColor = [UIColor whiteColor];
    bar61.defaultColor = [UIColor md_grey_500];
    bar61.slideStyle = UITapbarSlideStyleBottom;
    bar61.eventReceiver = self;
    bar61.barStyle = UITapbarStyleCenter;
    
    [bar61 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(50, 35)];
    [bar61 addSpace];
    [bar61 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar61 addSpace];
    [bar61 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    
    [self.view addSubview:bar61];
    
    bar61.direction = UITapbarDirectionVertical;
    [bar61 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(bar51.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
    HMUITapbarView *bar71 = [[HMUITapbarView alloc]init];
    bar71.space = 5;
    bar71.indentation = 10;
    bar71.tail = 10;
    bar71.backgroundColor = [UIColor whiteColor];
    bar71.defaultColor = [UIColor md_grey_500];
    bar71.slideStyle = UITapbarSlideStyleBottom;
    bar71.eventReceiver = self;
    bar71.barStyle = UITapbarStyleCanFlexible;
    
    [bar71 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(80, 35)];
    [bar71 addSpace:30];
    [bar71 addFlexible];
    [bar71 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(80, 35)];
    [bar71 addSpace];
    [bar71 addItemWithTitle:@"最新" imageName:nil size:CGSizeMake(50, 35)];
    [bar71 addSpace];
    [bar71 addItemWithTitle:@"分类" imageName:nil size:CGSizeMake(50, 35)];
    [bar71 addFlexible];
    [bar71 addItemWithTitle:@"精选" imageName:nil size:CGSizeMake(30, 35)];
    
    [self.view addSubview:bar71];
    
    bar71.direction = UITapbarDirectionVertical;
    [bar71 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.mas_equalTo(bar61.mas_right).offset(5);
        make.width.mas_equalTo(44);
        make.bottom.mas_equalTo(bar7.mas_top).offset(-15);
    }];
    
//    InfoSearchCell *cell = [InfoSearchCell spawn];
//    [self.view addSubview:cell];
//    [cell mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.view.mas_top).offset(0);
//        make.left.mas_equalTo(self.view.mas_left).offset(0);
//        make.height.mas_equalTo(40);
//        make.right.mas_equalTo(self.view.mas_right).offset(0);
//    }];
}


- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

ON_TapBar(signal){
    HMUITapbarView *bottomBar = signal.source;
    if ([signal is:[HMUITapbarView TAPCHANGED]]) {
    if (bottomBar.tag==200) {
        bottomBar.indentation=0;
        bottomBar.space=0;
        [bottomBar clearData];
        [bottomBar addItemWithTitle:@"有问有答2" imageName:nil size:CGSizeMake(self.view.width/4, 35)];
        
        [bottomBar addItemWithTitle:@"我的关注" imageName:nil size:CGSizeMake(self.view.width/4, 35)];
        [bottomBar addItemWithTitle:@"热门讨论" imageName:nil size:CGSizeMake(self.view.width/4, 35)];
        [bottomBar addItemWithTitle:@"积分兑换" imageName:nil size:CGSizeMake(self.view.width/4, 35)];
        [bottomBar updateItems];
        
        [self pushToPath:URLFOR_controllerWithNav(@"TabPage") animated:YES];
    }else if (bottomBar.tag == 121){
        if (bottomBar.selectedIndex==1) {
            [[bottomBar viewWithIndex:1] mas_updateConstraints:^(MASConstraintMaker *make) {
                make.width.mas_equalTo(40);
            }];
        }else{
            [[bottomBar viewWithIndex:1] mas_updateConstraints:^(MASConstraintMaker *make) {
                make.width.mas_equalTo(50);
            }];
        }
        
        [UIView animateWithDuration:.4f animations:^{
            [bottomBar updateItems];
        }];
    }
    }
}

ON_Button(signal){
    UIButten *btn = signal.source;
    if ([signal is:[UIButten TOUCH_UP_INSIDE]]) {
        if ([btn is:@"leftBtn"]) {//customNavLeftBtn
            [self backAndRemoveWithAnimate:YES];
        }else if ([btn is:@"rightBtn"]){//customNavRightBtn
            [self open:URLFOR_storyboardWithNav(@"Main.TabPage") close:URLFOR_controllerWithNav(@"UI") animate:YES];
        }
    }
}


@end
